package com.example.module_properties.adapter

import android.graphics.Color
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.module_properties.R
import com.yuwei.http.entity.PropertiesEntityItem

class ProperItemAdapter:BaseQuickAdapter<PropertiesEntityItem,BaseViewHolder>(R.layout.prop_item_item) {
    override fun convert(holder: BaseViewHolder, item: PropertiesEntityItem) {
        if (item.rented){
            holder.setText(R.id.prop_item_fj, "${ item.enterpriseId }室")
            holder.setText(R.id.prop_item_fj_wz,"企业:${item.enterpriseName}")
            holder.setText(R.id.prop_item_fj_mj,"面积:320m²")
            holder.setText(R.id.item_item_type,"已租")
                .setTextColor(R.id.item_item_type, Color.parseColor("#991B1B"))
                .setBackgroundResource(R.id.item_item_type, R.drawable.prorp_item_bg2)
        }else{
            holder.setText(R.id.prop_item_fj, "${ item.enterpriseId }室")
            holder.setText(R.id.prop_item_fj_wz,"企业:${item.enterpriseName}")
            holder.setText(R.id.prop_item_fj_mj,"面积:320m²")
            holder.setText(R.id.item_item_type,"出租")
                .setTextColor(R.id.item_item_type, Color.parseColor("#166534"))
                .setBackgroundResource(R.id.item_item_type, R.drawable.prorp_item_bg1)
        }
    }
}